import javax.swing.JOptionPane;
import javax.swing.UIManager;

import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;

import com.ifd.as400.IFDConnectionPool;
import com.ifd.gui.JSwingPad;


public class SpoolEditor {

	/**
	 * @param args
	 */
	static final Logger logger = Logger.getLogger(SpoolEditor.class);
	public static void main(String[] args) {
		try {
			UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
			//UIManager.put("PopupMenuUI","com.ifd.gui.CustomPopupMenuUI");*/
			
			//Using jgoodies library instead of system UIManager
			//UIManager.setLookAndFeel(com.jgoodies.looks.windows.WindowsLookAndFeel.class.getName());
			com.jgoodies.looks.Options.setPopupDropShadowEnabled(true);
		} catch (Exception e) {
			System.out.println("Cannot load Look and Feel");
		}
		try {
			PropertyConfigurator.configure("lib/log4j.conf");
			JSwingPad frame = new JSwingPad();
			frame.setVisible(true);
		} catch (Exception e) {
			if(!(e instanceof NullPointerException))
			JOptionPane.showMessageDialog(null, e.getLocalizedMessage(), 
					"SpoolFile Editor", JOptionPane.OK_OPTION);
			logger.error(e.getLocalizedMessage());
			IFDConnectionPool.closePool();
			System.exit(0);
		}
	}
}
